//part1:C07:ex7.3.cpp
#include <iostream>
#include "Sales_data.h"
using namespace std;

int main(void)
{
    cout << "Enter sale records(ISBN, units_sold, salesprice, sellprice)" << endl;
    Sales_data total;
    if (cin >> total)
    {
        Sales_data trans;
        while (cin >> trans)
        {
            if (total.isbn() == trans.isbn())
            {
                total.combine(trans);
            }
            else
            {
                cout << total << endl;
                total = trans;
            }
        }
        cout << total << endl;
    }
    else
    {
       cerr << "No data?!" << endl;
       return -1;
    }

    return 0;
}
